﻿package mortal.game.view.chat.chatPanel
{
    import __AS3__.vec.*;
    import com.gengine.utils.pools.*;
    import flash.display.*;
    import flash.text.engine.*;
    import mortal.game.view.chat.chatViewData.*;

    public class ChatNotes extends Sprite implements IDispose
    {
        private var _itemData:ChatItemData;
        private var _width:int;
        private var _lineHeight:Number;
        private var _isShowHead:Boolean = true;
        private var _groupVector:Vector.<ContentElement>;
        private var _itemTitleBg:Bitmap;
        private var _chatItem:ChatItem;

        public function ChatNotes()
        {
            this._groupVector = new Vector.<ContentElement>;
            return;
        }// end function

        public function init(param1:ChatItemData, param2:int = 260, param3:Number = 21, param4:Boolean = true) : void
        {
            this._width = param2;
            this._lineHeight = param3;
            this._itemData = param1;
            this._isShowHead = param4;
            this.mouseEnabled = false;
            this.createChildren();
            return;
        }// end function

        private function createChildren() : void
        {
            this._chatItem = ObjectPool.getObject(ChatItem);
            if (this._isShowHead)
            {
                this._chatItem.init(this._itemData.getAllElements(), this._width, this._lineHeight);
            }
            else
            {
                this._chatItem.init(this._itemData.getContentElement(), this._width, this._lineHeight);
            }
            this.addChild(this._chatItem);
            var _loc_1:* = this._chatItem.getFirstLineHeight();
            return;
        }// end function

        override public function get height() : Number
        {
            return this._chatItem.height;
        }// end function

        public function dispose(param1:Boolean = true) : void
        {
            this._itemData.dispose();
            this._itemData = null;
            this._width = 260;
            this._lineHeight = 21;
            this._isShowHead = true;
            this._groupVector = new Vector.<ContentElement>;
            this._chatItem.dispose();
            this._chatItem = null;
            var _loc_2:* = this.numChildren - 1;
            while (_loc_2 >= 0)
            {
                
                this.removeChildAt(_loc_2);
                _loc_2 = _loc_2 - 1;
            }
            x = 0;
            y = 0;
            this.alpha = 1;
            ObjectPool.disposeObject(this);
            return;
        }// end function

    }
}
